<template>
  <div class="userHome">
    <button class="loginOut" @click="loginOut">退出登录</button>
  </div>
</template>

<script>
import store from "@/store";
export default {
  methods: {
    loginOut() {
      localStorage.removeItem("x-auth-token");
      store.dispatch("showToast/asyncIsShowToast", {
        type: "success",
        msg: "退出成功",
      });
      setTimeout(() => {
        this.$router.push("/home");
      }, 1000);
    },
  },
};
</script>

<style lang="scss" scoped>
.loginOut {
  background-color: #0a328e;
  color: #ccc;
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
}
</style>
